/*
 * Copyright 2006-2008 Kees de Kooter
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.meraklisina.latexeditor.mdi.Pane;

import java.awt.Color;
import java.util.regex.Pattern;

import javax.swing.JTextPane;
import com.meraklisina.latexeditor.mdi.Pane.XmlViewFactory;


/**
 * JTextPane implementation that can handle xml text.
 *  
 * @author kees
 * @date 27-jan-2006
 *
 */
public class SweTextPane extends JTextPane {

    private static final long serialVersionUID = 6270183148379328084L;
    
    public  XmlEditorKit xmlEditorKit ;

    public SweTextPane() {
        
        // Set editor kit
        this.xmlEditorKit = new XmlEditorKit();
        
        this.setEditorKitForContentType("text/xml",this.xmlEditorKit );
        this.setContentType("text/xml");
        
        
    }
    
    public void putPattern( Pattern pattern, Color color)
    {
        ((XmlViewFactory)this.xmlEditorKit.getViewFactory( )).myXmlview.putPattern(pattern,  color );        
    }
}
